import request from "@/utils/request";
import { generateMD5Validate } from "@/utils/common";
const BASE_URL = "/api/v1";
/***
 *
 * 入驻资料提交
 *
 */
// 公司入驻信息提交

export function addMerchantCompany(data) {
  return request({
    url: `${BASE_URL}/enterInfo/addCompany`,
    method: "post",
    data,
  });
}

// 个人入驻信息提交
export function addMerchantEmployee(data) {
  return request({
    url: `${BASE_URL}/enterInfo/addEmployee`,
    method: "post",
    data,
  });
}

// 编辑公司入驻信息
export function editMerchantCompany(data) {
  return request({
    url: `${BASE_URL}/enterInfo/editCompany`,
    method: "post",
    data,
  });
}

// 编辑个人入驻信息
export function editMerchantEmployee(data) {
  return request({
    url: `${BASE_URL}/enterInfo/editEmployee`,
    method: "post",
    data,
  });
}

// 查询入驻状态
export function getMerchantStatus() {
  return request({
    url: `${BASE_URL}/enterInfo/status`,
    method: "get",
  });
}

// 获取营业执照信息
export function getBusinessLicenseInfo(params) {
  return request({
    url: `${BASE_URL}/ocr/getBusinessLicenseInfo`,
    method: "get",
    params: params,
  });
}

// 获取身份证背面信息
export function getIdCardBackInfo(params) {
  const { OCR_TIME, OCR_UUID, OCR_SECRET } = generateMD5Validate();
  return request({
    headers: {
      ocrTime: OCR_TIME,
      ocrUuid: OCR_UUID,
      ocrSecret: OCR_SECRET,
    },
    url: `${BASE_URL}/ocr/getIdCardBackInfo`,
    method: "get",
    params: params,
  });
}

// 获取身份证正面信息
export function getIdCardFaceInfo(params) {
  const { OCR_TIME, OCR_UUID, OCR_SECRET } = generateMD5Validate();

  return request({
    headers: {
      ocrTime: OCR_TIME,
      ocrUuid: OCR_UUID,
      ocrSecret: OCR_SECRET,
    },
    url: `${BASE_URL}/ocr/getIdCardFaceInfo`,
    method: "get",
    params: params,
  });
}
